<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>Title</title>
</head>
<body>
<button onclick="test()">点击</button>
<script type="text/javascript">
    var timer = setTimeout(()=>{
        console.log("good")
    },5000)
    function test() {
        clearTimeout(timer)
    }
</script>
</body>
</html>